![]() |
CharWidth |
||||
Header: | QuickdrawText.h | Carbon status: | Supported | |
Returns the width (horizontel extension), in pixels, of the specified character.
SInt16 CharWidth ( CharParameter ch );
The character whose width is to be measured.
The width (horizontel extension), in pixels, of the specified character.
The CharWidth function includes the effects of the stylistic variations for the text set in the current graphics port. If you change any of these attributes after determining the glyph width but before actually drawing it, the predetermined width may not be correct. For a space character, CharWidth also includes the effect of SpaceExtra. For a nonspace character, CharWidth includes the effect of CharExtra.
Because it takes a single-byte value as the ch parameter, CharWidth works only for 1-byte simple script systems.
A series of calls to CharWidth in a contextual 1-byte font may give incorrect results, because the width of a text segment may be different from the sum of its individual character widths. In that case, to measure a line of text you should call TextWidth.
Do not use the CharWidth function for 2-byte script systems. If you want to measure the width of a single glyph in a 2-byte font, you should use TextWidth.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)